<?php
class BarCodeSearchWidget extends CWidget {
	public function init() {
		parent::init();
		$localPath = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
		$publishPath = Yii::app()->getAssetManager()->publish($localPath, false, -1, true);
		Yii::app()->clientScript->registerCssFile($publishPath . '/barcode.css');
	}
	public function run() {
		$this->render('_search');
		Yii::app()->clientScript
			->registerScript(__CLASS__,
				'$("#bar-code-search-form").submit(function(e) {
    e.preventDefault(); 
    this.submit(); 
    setTimeout(function(){
        $("#bar-code-search-input").val(""); 
    }, 100);
});');
	}
}
